<?php

class Application_Model_Task extends Application_Model_ModelAbstract
{
    protected $task_id;
    protected $task_title;
    protected $task_description;
    protected $task_date;
    protected $task_notify;
    protected $task_type;
    protected $task_limit;
    protected $task_priority;

    const CURRENT       = 1;
    const ON_YEAR       = 2;

    const NOTIFY_EVERYDAY          = 3;
    const NOTIFY_ONE_DAY_WEEK      = 4;
    const NOTIFY_ONE_DAY_MONTH     = 5;
    const NOTIFY_ONE_DAY_YEAR      = 6;

    const LOW_PRIORITY    = 1;
    const MIDDLE_PRIORITY = 2;
    const HIGHT_PRIORITY  = 3;

    const STATUS_ARCHIVE  = 1;
    const STATUS_OPEN     = 0;

    public static $limits = array(
        self::CURRENT => "Текущая",
        self::ON_YEAR => "На год",
    );

    public static $notifies = array(
        self::NOTIFY_EVERYDAY      => 'Каждый день',
        self::NOTIFY_ONE_DAY_WEEK  => 'Раз в неделю',
        self::NOTIFY_ONE_DAY_MONTH => 'Раз в месяц',
        self::NOTIFY_ONE_DAY_YEAR  => 'Раз в год',
    );

    public static $priorities = array(
        self::LOW_PRIORITY    => 'Низкий приоритет',
        self::MIDDLE_PRIORITY => 'Средний приоритет',
        self::HIGHT_PRIORITY  => 'Высокий приоритет',
    );

    public function setTaskDate($task_date)
    {
        $this->task_date = $task_date;
    }

    public function getTaskDate()
    {
        return date('Y-m-d', strtotime($this->task_date));
    }

    public function setTaskDescription($task_description)
    {
        $this->task_description = $task_description;
    }

    public function getTaskDescription()
    {
        return $this->task_description;
    }

    public function setTaskId($task_id)
    {
        $this->task_id = $task_id;
    }

    public function getTaskId()
    {
        return $this->task_id;
    }

    public function setTaskLimit($task_limit)
    {
        $this->task_limit = $task_limit;
    }

    public function getTaskLimit()
    {
        return $this->task_limit;
    }

    public function setTaskNotify($task_notify)
    {
        $this->task_notify = $task_notify;
    }

    public function getTaskNotify()
    {
        return $this->task_notify;
    }

    public function setTaskPriority($task_priority)
    {
        $this->task_priority = $task_priority;
    }

    public function getTaskPriority()
    {
        return $this->task_priority;
    }

    public function setTaskTitle($task_title)
    {
        $this->task_title = $task_title;
    }

    public function getTaskTitle()
    {
        return $this->task_title;
    }

    public function setTaskType($task_type)
    {
        $this->task_type = $task_type;
    }

    public function getTaskType()
    {
        return $this->task_type;
    }

    public function getCssClass()
    {
        switch ($this->getTaskPriority()) {
            case self::HIGHT_PRIORITY:
                return 'pr-hight';
            case self::MIDDLE_PRIORITY:
                return 'pr-middle';
            default:
                return 'pr-low';
        }
    }
}